from django.db import models
from elasticsearch import Elasticsearch


# Create your models here.


# 连接es做数据查询
class EsTools:

    def __init__(self):
        self.es = Elasticsearch("http://127.0.0.1:9200")

    # 提供查询的函数
    def query_data(self, body):
        result = self.es.search(index="tcdata", body=body)
        return result
